package org.example01.System1;

import java.io.IOException;
import java.time.LocalDate;

public class Demo {
    public static void main(String[] args) throws IOException {
        //testPrimaryStudent();
        testJuniorHighStudent();
        //testAvatar();
    }

    private static void testJuniorHighStudent() {
        StudentManageSystem sms = new StudentManageSystem();
        sms.addStudent(new JuniorHighStudent("20241316", "逍遥", 88, 62, 90, 81, LocalDate.of(2024, 1, 1), "1316@six.com"));
        sms.addStudent(new JuniorHighStudent("20241316", "月如", 99, 54, 76, 88, LocalDate.of(2024, 1, 1), "1316@six.com"));
        sms.addStudent(new JuniorHighStudent("20241316", "灵儿", 82, 49, 84, 92, LocalDate.now(), "1316@six.com"));
        sms.addStudent(new JuniorHighStudent("20241316", "唐珏", 75, 63, 96, 100, LocalDate.now(), "1316@six.com"));
        System.out.println("------------获取所有学生的信息---------------");
        sms.showAllStudent();
        System.out.println("------------获取所有学生中语文最高成绩---------------");
        System.out.println(sms.findStudentWithHighScore("语文"));
        System.out.println("------------获取所有学生中数学最低成绩---------------");
        System.out.println(sms.findStudentWithLowScore("数学"));
        System.out.println("------------获取学生的语文平均成绩---------------");
        System.out.println(sms.getAverageScoreBySubject("语文"));
        System.out.println("------------排名--------------");
        sms.sortStudentByTotalScore();
        System.out.println("-------------根据学号查询学生信息---------------");
        sms.showStudentByID("20241316");
        System.out.println("------------随机点名---------------");
        System.out.println(sms.randomStudent());
        System.out.println("-------------获取指定科目所有对应分数的人数---------------");
        System.out.println(sms.getScoreStatisticsBySubject("语文"));
        sms.sortStudentByTotalScoreAndToFile("Day23/JuniorHighStudent.txt");
    }

    private static void testPrimaryStudent() {
        StudentManageSystem sms = new StudentManageSystem();
        sms.addStudent(new PrimaryStudent("20241316", "小新", 77, 81, LocalDate.of(2024, 1, 1), "1316@six.com"));
        sms.addStudent(new PrimaryStudent("20241327", "小明", 95, 88, LocalDate.of(2024, 1, 3), "1316@six.com"));
        sms.addStudent(new PrimaryStudent("20241333", "花花", 90, 63, LocalDate.now(), "1316@six.com"));
        sms.addStudent(new PrimaryStudent("20241335", "天天", 71, 83, LocalDate.now(), "1316@six.com"));
        System.out.println("------------获取所有小学生的信息---------------");
        sms.showAllStudent();
        System.out.println("------------获取所有小学生中语文最高成绩---------------");
        System.out.println(sms.findStudentWithHighScore("语文"));
        System.out.println("------------获取所有小学生中数学最低成绩---------------");
        System.out.println(sms.findStudentWithLowScore("数学"));
        System.out.println("------------获取小学生的语文平均成绩---------------");
        System.out.println(sms.getAverageScoreBySubject("语文"));
        System.out.println("------------排名--------------");
        sms.sortStudentByTotalScore();
        System.out.println("-------------根据学号查询学生信息---------------");
        sms.showStudentByID("20241335");
        System.out.println("------------获取指定日期以后入学的学生---------------");
        sms.showAllStudent(sms.getStudentsAfterData("2024-01-03"));
        System.out.println("------------获取指定日期以前入学的学生---------------");
        sms.showAllStudent(sms.getStudentsBeforeData("2025-01-01"));
        System.out.println("------------随机点名---------------");
        System.out.println(sms.randomStudent());
    }
    public static void testAvatar() throws IOException {
        StudentManageSystem sms = new StudentManageSystem();
        PrimaryStudent stu = new PrimaryStudent("20241316", "小新", 77, 81, LocalDate.of(2024, 1, 1), "1316@six.com");
        sms.addStudent(stu);
        sms.uploadAvatar(stu, "Day22/aaa.jpg","Day22/avatar");
        System.out.println(stu);
    }
}
